package com.laozhao.deliveryManager;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import com.laozhao.deliveryManager.control.MainWindowsControl;
import com.laozhao.dreamframe.util.FrameFactory;

/**
 * 
 */

/**
 * @author LaoZhao
 *
 */
public class StartPage {

	public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		MainWindowsControl mainWindow = FrameFactory.setMainFrame(MainWindowsControl.class);
		mainWindow.setTitle("销售系统");
		mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainWindow.setVisible(true);
	}
	/*public static void main(String[] args) {

		JFrame.setDefaultLookAndFeelDecorated(true);
		JDialog.setDefaultLookAndFeelDecorated(true);

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
//				SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());
				SubstanceLookAndFeel.setSkin(new OfficeBlue2007Skin());
				try {
					
					final MainWindowsControl mainWindow = FrameFactory.setMainFrame(MainWindowsControl.class);
					mainWindow.setTitle("销售系统");
					mainWindow.setVisible(true);

					mainWindow.setLocationRelativeTo(mainWindow.getOwner());
					mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
					mainWindow.setIconImage(Toolkit.getDefaultToolkit().createImage(
							StartPage.class.getResource("icon.png")));
//					mainWindow.setIconImage(new ImageIcon(ToolsUtil.getRoot() + "\\img\\icon.gif").getImage());
//					mainWindow.setIconImage(Toolkit.getDefaultToolkit().createImage(
//							MainWindowsControl.class.getResource("icon.png")));
					mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
					mainWindow.addWindowListener(new WindowAdapter() {
						public void windowClosing(WindowEvent e) {
							int flag = JOptionPane.showConfirmDialog(mainWindow,
									"Sure to close?", "Care!",
									JOptionPane.YES_NO_OPTION,
									JOptionPane.INFORMATION_MESSAGE);
							if (JOptionPane.YES_OPTION == flag) {
								System.exit(0);
							} else {
								return;
							}
						}
					});
					mainWindow.init();
					ToolsUtil.setToCenter(mainWindow);

				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}*/
}
